package com.hyh.shiyanshiguanli.mapper;

import com.hyh.shiyanshiguanli.domain.entity.Reagent;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author hyh
 * @version 1.0
 */
@Mapper
public interface ReagentMapper {

    @Select("select * from reagent where id = #{reagentId}")
    Reagent selectById(@Param("reagentId") Integer reagentId);

    @Update("update reagent set num = num - #{needNum} where id = #{reagentId}")
    void deleteNum(@Param("needNum") Integer needNum,@Param("reagentId") Integer reagentId);

    @Update("update reagent set num = num + #{needNum} where id = #{reagentId}")
    void addNum(@Param("needNum") Integer needNum,@Param("reagentId") Integer reagentId);
}
